-- CALC_MAMMOTH_UNREAL_GRIDS
-- 猛犸夹层格子

return function(dungeonId, unrealId)
    local ids = {20013, 20023, 20033};

    if table.indexOf(ids, dungeonId) < 0 then
        return {};
    end

    local ret = {};
    for pos = 1, GRID_SIZE do
        ret[pos] = { [GRID_TYPE_EMPTY] = 0, };
    end

    if dungeonId == 20013 then
        ret[17]  = { [GRID_TYPE_MONSTER] = 20527, };  -- 狮子
        ret[19]  = { [GRID_TYPE_MONSTER] = 20528, };  -- 豹子
        ret[8]   = { [GRID_TYPE_MONSTER] = 20525, };  -- 猛犸BOSS
        ret[26]  = { [GRID_TYPE_BOARD] = 20531, };  -- 木牌
        ret[30]  = { [GRID_TYPE_DOOR]  = 0, };  -- 门
    elseif dungeonId == 20023 then
        ret[17]  = { [GRID_TYPE_MONSTER] = 20837, };  -- 狮子
        ret[19]  = { [GRID_TYPE_MONSTER] = 20838, };  -- 豹子
        ret[8]   = { [GRID_TYPE_MONSTER] = 20835, };  -- 猛犸BOSS
        ret[26]  = { [GRID_TYPE_BOARD] = 20841, };  -- 木牌
        ret[30]  = { [GRID_TYPE_DOOR]  = 0, };  -- 门
    else
        ret[17]  = { [GRID_TYPE_MONSTER] = 21130, };  -- 狮子
        ret[19] = { [GRID_TYPE_MONSTER] = 21131, };  -- 豹子
        ret[8] = { [GRID_TYPE_MONSTER] = 21128, };  -- 猛犸BOSS
        ret[26] = { [GRID_TYPE_BOARD] = 21121, };  -- 木牌
        ret[30] = { [GRID_TYPE_DOOR]  = 0, };  -- 门
    end

    -- 配置的
    local layout = UnrealDungeonM.query(unrealId, "layout");
    for pos = 1, GRID_SIZE do
        -- 客户端的位置应该比服务器+1
        local class = layout[pos - 1];

        if class then
            if class == GRID_TYPE_BLOCK then
                -- 隐形障碍格
                ret[pos] = { [class] = 0, };
            else
                ret[pos] = { [class] = UnrealDungeonM.fetchElement(class, dungeonId, unrealId), };
            end
        end
    end

    return ret;
end
